# coding: utf-8

{{>partial_header}}

from __future__ import absolute_import

import re  # noqa: F401
import sys  # noqa: F401

# python 2 and python 3 compatibility library
import six

from {{packageName}}.api_client import ApiClient, Endpoint
from {{packageName}}.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    int,
    none_type,
    str,
    validate_and_convert_types
)
{{#imports}}
{{{import}}}
{{/imports}}


{{#operations}}
class {{classname}}(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
{{#operation}}

        def __{{operationId}}(
            self,
{{#requiredParams}}
{{^defaultValue}}
            {{paramName}},
{{/defaultValue}}
{{/requiredParams}}
{{#requiredParams}}
{{#defaultValue}}
            {{paramName}}={{{defaultValue}}},
{{/defaultValue}}
{{/requiredParams}}
            **kwargs
        ):
            """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}}  # noqa: E501

{{#notes}}
            {{{notes}}}  # noqa: E501
{{/notes}}
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.{{operationId}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{{defaultValue}}}, {{/defaultValue}}{{/requiredParams}}async_req=True)
            >>> result = thread.get()

{{#requiredParams}}
{{^hasMore}}
            Args:
{{/hasMore}}
{{/requiredParams}}
{{#requiredParams}}
{{^defaultValue}}
                {{paramName}} ({{dataType}}):{{#description}} {{description}}{{/description}}
{{/defaultValue}}
{{/requiredParams}}
{{#requiredParams}}
{{#defaultValue}}
                {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]
{{/defaultValue}}
{{/requiredParams}}

            Keyword Args:{{#optionalParams}}
                {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{/optionalParams}}
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int): specifies the index of the server
                    that we want to use.
                    Default is 0.
                async_req (bool): execute request asynchronously

            Returns:
                {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index', 0)
{{#requiredParams}}
            kwargs['{{paramName}}'] = \
                {{paramName}}
{{/requiredParams}}
            return self.call_with_http_info(**kwargs)

        self.{{operationId}} = Endpoint(
            settings={
                'response_type': {{#returnType}}({{{returnType}}},){{/returnType}}{{^returnType}}None{{/returnType}},
{{#authMethods}}
{{#-first}}
                'auth': [
{{/-first}}
                    '{{name}}'{{#hasMore}},{{/hasMore}}
{{#-last}}
                ],
{{/-last}}
{{/authMethods}}
{{^authMethods}}
                'auth': [],
{{/authMethods}}
                'endpoint_path': '{{{path}}}',
                'operation_id': '{{operationId}}',
                'http_method': '{{httpMethod}}',
{{#servers}}
{{#-first}}
                'servers': [
{{/-first}}
                    '{{{url}}}'{{^-last}},{{/-last}}
{{#-last}}
                ]
{{/-last}}
{{/servers}}
{{^servers}}
                'servers': [],
{{/servers}}
            },
            params_map={
                'all': [
{{#allParams}}
                    '{{paramName}}',
{{/allParams}}
                ],
{{#requiredParams}}
{{#-first}}
                'required': [
{{/-first}}
                    '{{paramName}}',
{{#-last}}
                ],
{{/-last}}
{{/requiredParams}}
{{^requiredParams}}
                'required': [],
{{/requiredParams}}
                'nullable': [
{{#allParams}}
{{#isNullable}}
                    '{{paramName}}',
{{/isNullable}}
{{/allParams}}
                ],
                'enum': [
{{#allParams}}
{{#isEnum}}
                    '{{paramName}}',
{{/isEnum}}
{{/allParams}}
                ],
                'validation': [
{{#allParams}}
{{#hasValidation}}
                    '{{paramName}}',
{{/hasValidation}}
{{/allParams}}
                ]
            },
            root_map={
                'validations': {
{{#allParams}}
{{#hasValidation}}
                    ('{{paramName}}',): {
{{#maxLength}}
                        'max_length': {{maxLength}},{{/maxLength}}{{#minLength}}
                        'min_length': {{minLength}},{{/minLength}}{{#maxItems}}
                        'max_items': {{maxItems}},{{/maxItems}}{{#minItems}}
                        'min_items': {{minItems}},{{/minItems}}{{#maximum}}
                        {{#exclusiveMaximum}}'exclusive_maximum'{{/exclusiveMaximum}}'inclusive_maximum'{{^exclusiveMaximum}}{{/exclusiveMaximum}}: {{maximum}},{{/maximum}}{{#minimum}}
                        {{#exclusiveMinimum}}'exclusive_minimum'{{/exclusiveMinimum}}'inclusive_minimum'{{^exclusiveMinimum}}{{/exclusiveMinimum}}: {{minimum}},{{/minimum}}{{#pattern}}
                        'regex': {
                            'pattern': r'{{{vendorExtensions.x-regex}}}',  # noqa: E501{{#vendorExtensions.x-modifiers}}
                            {{#-first}}'flags': (re.{{.}}{{/-first}}{{^-first}}          re.{{.}}{{/-first}}{{^-last}} | {{/-last}}{{#-last}}){{/-last}}{{/vendorExtensions.x-modifiers}}
                        },{{/pattern}}
                    },
{{/hasValidation}}
{{/allParams}}
                },
                'allowed_values': {
{{#allParams}}
{{#isEnum}}
                    ('{{paramName}}',): {
{{#isNullable}}
                        'None': None,{{/isNullable}}{{#allowableValues}}{{#enumVars}}
                        "{{name}}": {{{value}}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
                    },
{{/isEnum}}
{{/allParams}}
                },
                'openapi_types': {
{{#allParams}}
                    '{{paramName}}':
                        ({{{dataType}}},),
{{/allParams}}
                },
                'attribute_map': {
{{#allParams}}
{{^isBodyParam}}
                    '{{paramName}}': '{{baseName}}',
{{/isBodyParam}}
{{/allParams}}
                },
                'location_map': {
{{#allParams}}
                    '{{paramName}}': '{{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isCookieParam}}cookie{{/isCookieParam}}{{#isBodyParam}}body{{/isBodyParam}}',
{{/allParams}}
                },
                'collection_format_map': {
{{#allParams}}
{{#collectionFormat}}
                    '{{paramName}}': '{{collectionFormat}}',
{{/collectionFormat}}
{{/allParams}}
                }
            },
            headers_map={
{{#hasProduces}}
                'accept': [
{{#produces}}
                    '{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
{{/produces}}
                ],
{{/hasProduces}}
{{^hasProduces}}
                'accept': [],
{{/hasProduces}}
{{#hasConsumes}}
                'content_type': [
{{#consumes}}
                    '{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
{{/consumes}}
                ]
{{/hasConsumes}}
{{^hasConsumes}}
                'content_type': [],
{{/hasConsumes}}
            },
            api_client=api_client,
            callable=__{{operationId}}
        )
{{/operation}}
{{/operations}}
